<template>
    <div class="wrapper">
        <header>
            <i class="fa fa-angle-left" onclick="history.go(-1)"></i>
            <p>重置密码</p>
            <div></div>
        </header>
        <div class="top-ban"></div>
        <h1>重置密码</h1>
        <table>
            <tr>
                <td>手机号码</td>
                <td><input type="text" v-model="form.userId" placeholder="请输入修改密码的手机号码"></td>
            </tr>
            <tr>
                <td>身份证号</td>
                <td><input type="text" v-model="form.identityCard" placeholder="请输入身份证验证您的身份"></td>
            </tr>
        </table>
        <div class="btn" @click="handleVerify(form)">提交</div>
    </div>
</template>

<script setup>
const router = useRouter();
import { ElMessage } from 'element-plus';
import { handleverify } from '@/api/updatePassword';
const data = reactive({
    form: {
    userId:'',
    realName:'',
    birthday:'',
    sex:'',
    identityCard:'',
    password:'',
    ensurePassword:'',
    }
});
const {  form } = toRefs(data);

// 注册
function handleVerify(form) {
    if(form.userId=="")
        {
            ElMessage.error("手机号不能为空");
            return;
        }
        if(form.identityCard=="")
        {
            ElMessage.error("身份证号不能为空");
            return;
        }
        handleverify(form).then((response) => {
            console.log(response.data)
        if (response.data.code == 1) {
            ElMessage.success('验证成功');
            console.log(form.userId),
            router.push({path:'/updateIndex',query:{userId:form.userId
        }
    })
        } else {
            ElMessage.error(response.data.msg);
        }
    });
       
}
</script>

<style scoped>
    /*********************** 总容器 ***********************/
    .wrapper{
    width: 100%;
    height: 100%;
}

/*********************** header ***********************/
header{
    width: 100%;
    height: 15.7vw;
    background-color: #FFF;

    position: fixed;
    left: 0;
    top: 0;

    display: flex;
    align-items: center;
    justify-content: space-between;

    box-sizing: border-box;
    padding: 0 3.6vw;
}
header .fa{
    font-size: 8vw;
}

/*********************** 标题部分 ***********************/
h1{
    font-size: 7.4vw;
    font-weight: 500;
    box-sizing: border-box;
    padding: 0 3.6vw;
    margin-top: 6vw;
}

/*********************** common样式 ***********************/
.top-ban{
    width: 100%;
    height: 15.7vw;
}

/*********************** table ***********************/
table{
    width: 92.8vw;
    margin: 0 auto;
    margin-top: 5vw;
    border-collapse: collapse;

    font-size: 4.2vw;
}
table tr td{
    height: 12vw;
    border-bottom: solid 1px #DDD;
}
table tr td input{
    border: none;
    outline: none;
}

/*********************** btn ***********************/
.btn{
    width: 92.8vw;
    margin: 0 auto;
    height: 12vw;
    margin-top: 8vw;
    background-color: #137E92;
    border-radius: 2vw;
    color: #FFF;
    font-size: 5vw;
    text-align: center;
    line-height: 12vw;

    user-select: none;
    cursor: pointer;
}
</style>